package cn.iocoder.yudao.module.book.dal.mysql.protocol;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.book.controller.app.protocolAndmethod.vo.AppProtocolRespVO;
import cn.iocoder.yudao.module.book.dal.dataobject.protocol.ProtocolDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.book.controller.admin.protocol.vo.*;

/**
 * 协议 Mapper
 *
 * @author xi
 */
@Mapper
public interface ProtocolMapper extends BaseMapperX<ProtocolDO> {

    default PageResult<ProtocolDO> selectPage(ProtocolPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProtocolDO>()
                .eqIfPresent(ProtocolDO::getProtocolId, reqVO.getProtocolId())
                .eqIfPresent(ProtocolDO::getContent, reqVO.getContent())
                .betweenIfPresent(ProtocolDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProtocolDO::getProtocolId));
    }

    AppProtocolRespVO selectAll();
}